package com.wlc.base.lambda;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description 练习题
 * @date 2021-07-14 09:34
 */
public class TestLambda4 {

    private static void insertFirst(List<Integer> l, String type) {
        int total = 1000 * 100;
        final int number = 5;
        long start = System.currentTimeMillis();
        for (int i = 0; i < total; i++) {
            l.add(0, number);
        }
        long end = System.currentTimeMillis();
        System.out.printf("在%s 最前面插入%d条数据，总共耗时 %d 毫秒 %n", type, total, end - start);
    }

    public static void method01() {
        List l;
        l = new ArrayList<>();
        insertFirst(l, "ArrayList");
        l = new LinkedList();
        insertFirst(l, "linkedList");

    }

    public static void method02() {
        //insertFirst2(ArrayList::new, "hell");
        //insertFirst2(ArrayList::new, "abc");
    }

    public static void insertFirst2(Object o, String str) {

    }

    public static void main(String[] args) {
        method01();
    }

}
